using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using FutureOpen.Core.func.sql;
using FutureOpen.Core.func.util;
using FutureOpen.Web.Pages;
using System.Text;


public partial class controls_GroupHotByCat : System.Web.UI.UserControl
{
    private PageBase pbase;
    private int catid;

    protected void Page_Load(object sender, EventArgs e)
    {
        pbase = (PageBase)this.Page;
        pbase.PageInit();
        catid = pbase.catid;

        if (!Page.IsPostBack)
        {
            LoadGroups(0, 15);
        }
    }
    public void LoadGroups(int start, int end)
    {
        if (this.catid >= 0)
        {
            DataSet ds = GroupProvider.GetGroupByCat(this.catid, start, end, GroupProvider.ORDERBY_LASTUPDATE);
            this.DataList1.DataSource = ds.Tables[0];
            this.DataList1.DataBind();           
        }
        else
        {
            DataSet ds = GroupProvider.GetGroup(start, end, GroupProvider.ORDERBY_LASTUPDATE);
            this.DataList1.DataSource = ds.Tables[0];
            this.DataList1.DataBind(); 
        }
    }

    
    public string GetBrief(object obj)
    {
        string str = obj.ToString();
        return StringUtil.ShortenStr(str); 
    }

    public string Shorten(object obj)
    {
        string str = obj.ToString();
        if (str.Length > 6)
        {
            return str.Substring(0, 6) + "..";
        }
        return str;

    }
}

